
$('.a').mouseenter(function () {
    $('ul span:last-child')
        .stop()
        .animate({
            left: 90 * $(this).index()
        })
})
//鼠标移入img 提示显示
let img = document.querySelector('.img')
let img_tip = img.parentNode.children[1]
let code = document.querySelector('.code')
img.onmouseenter = function () {
    img_tip.style.display = 'block'
}
img.onmouseleave = function () {
    img_tip.style.display = 'none'
}
$('.img').on('click', function () {
    code.style.display = 'flex'
})
let img1 = document.querySelectorAll('.img')[1]
let img1_tip = img1.parentNode.children[5]
img1.onmouseenter = function () {
    img1_tip.style.display = 'block'
}
img1.onmouseleave = function () {
    img1_tip.style.display = 'none'
}
$('.img1').on('click', function () {
    code.style.display = 'none'
})
// 
function AGE(a, r, t) {
    var n = a.val().trim();//去除前后的空格
    var r
    if (r.test(n)) {
        t.text('YES')
        t.removeClass('wrong')
        t.addClass('right_light')
        return true
    }
    else {
        t.text('NO')
        t.addClass('wrong')
        return false
    }
}
let res1 = function () {
    return AGE($('.ipt_One'), /\d{6}/, $('.tip'))
}
let res2 = function () {
    return AGE($('.ipt_Psd'), /^(?=.*\d)(?=.*[a-zA-Z])[\da-zA-Z~!@#$%^&*]{6,18}$/, $('.pwd_tip'))
}
let btn=document.querySelector('.btn')
var flag=null
btn.onclick=()=>{
       flag = btn.checked
       if(flag==true){
           btn_tip.innerHTML='YES'
           btn_tip.className='right_light'
       }else{
           btn_tip.innerHTML='NO'
           btn_tip.className='wrong'
       }
 }
 let btn_tip=btn.parentNode.children[1]

$('.ipt_One').on('input', res1)
$('.ipt_Psd').on('input', res2)
$('.sub').on('submit', function (e) {
  //  console.log((res1() && res2()&&res3()))
    if (!(res1() && res2()&&flag)) {
        e = e || window.event;
        btn_tip.innerHTML = 'NO'
        btn_tip.className = 'wrong'
        e.preventDefault ? e.preventDefault() : e.returnValue = false;
        
    }
    
})
$('.sub').click(function(){
    let use=$('.ipt_One').val()
    let p=$('.ipt_Psd').val()
    setCookie(uesr,use)
})